package com.cynteka.cyfoman.ui;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * User: Sergey
 * Date: 03.08.11
 * Time: 2:35
 */
public class SendEventAction extends AbstractAction implements Action {
    private IEvent event;

    private EventDispatcher eventDispatcher;

    public EventDispatcher getEventDispatcher() {
        return eventDispatcher;
    }

    public void setEventDispatcher(EventDispatcher eventDispatcher) {
        this.eventDispatcher = eventDispatcher;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        eventDispatcher.sendEvent(event);
    }

    public IEvent getEvent() {
        return event;
    }

    public void setEvent(IEvent event) {
        this.event = event;
    }

    public String getLongDescription() {
        return String.valueOf(getValue(LONG_DESCRIPTION));
    }

    public void setLongDescription(String desc) {
        putValue(LONG_DESCRIPTION, desc);
    }

    public String getShortDescription() {
        return String.valueOf(getValue(SHORT_DESCRIPTION));
    }

    public void setShortDescription(String desc) {
        putValue(SHORT_DESCRIPTION, desc);
    }

    public String getName() {
        return String.valueOf(getValue(NAME));
    }

    public void setName(String name) {
        putValue(NAME, name);
    }

}
